function w = weightsMatrix(patterns)
    for i=1:columns(patterns)
	matrix(i,:) = patterns{1,i};
    endfor
    w = matrix' * matrix;
    N = length(matrix);
    w = w/N;
    for i=1:N
	w(i,i) = 0;
    endfor
endfunction
